package com.yonyou.iuap.ipaas.connector.sdwcoatencent.internal.operation;

import cn.hutool.json.JSONUtil;
import com.yonyou.iuap.ipaas.connector.sdk.api.model.ResponseAttributes;
import com.yonyou.iuap.ipaas.connector.sdwcoatencent.api.model.common.PageableData;
import com.yonyou.iuap.ipaas.connector.sdwcoatencent.api.model.common.UrlConstant;
import com.yonyou.iuap.ipaas.connector.sdwcoatencent.api.model.request.sale.ReturnsWorkOrderQueryRequest;
import com.yonyou.iuap.ipaas.connector.sdwcoatencent.api.model.request.sale.WmsOrderListQueryRequest;
import com.yonyou.iuap.ipaas.connector.sdwcoatencent.api.model.request.stock.InboundListQueryRequest;
import com.yonyou.iuap.ipaas.connector.sdwcoatencent.api.model.response.purchase.PurReturnQueryResponse;
import com.yonyou.iuap.ipaas.connector.sdwcoatencent.internal.LxwcoatencentConnection;
import com.yonyou.yonlinker.ysb.runtime.extension.api.annotation.param.Connection;
import com.yonyou.yonlinker.ysb.runtime.extension.api.annotation.param.Content;
import com.yonyou.yonlinker.ysb.runtime.extension.api.annotation.param.MediaType;
import com.yonyou.yonlinker.ysb.runtime.extension.api.runtime.operation.Result;

public class SaleOperations {
    /**
     * 销售出库汇总列表查询
     * @param connection
     * @param wmsOrderListQueryRequest
     * @return
     */
    @MediaType(
            strict = false,
            value = "application/json"
    )
    public Result<String, ResponseAttributes> querySaleOutMergeList(@Connection LxwcoatencentConnection connection, @Content WmsOrderListQueryRequest wmsOrderListQueryRequest) {
        PageableData<PurReturnQueryResponse> result = connection.doQuery(UrlConstant.SALE_OUT_LIST, JSONUtil.parseObj(wmsOrderListQueryRequest));
        return connection.returnCommonResult("querySaleOutList", result);
    }

    /**
     * 退货入库汇总列表查询
     * @param connection
     * @param saleReturnMergeReq
     * @return
     */
    @MediaType(
            strict = false,
            value = "application/json"
    )
    public Result<String, ResponseAttributes> saleReturnMergeList(@Connection LxwcoatencentConnection connection, @Content InboundListQueryRequest saleReturnMergeReq) {
        PageableData<PurReturnQueryResponse> result = connection.doQuery(UrlConstant.INBOUND_QUERY_URL, JSONUtil.parseObj(saleReturnMergeReq));
        return connection.returnCommonResult("querySaleReturnList", result);
    }
    /**
     * 售后工单列表查询
     * @param connection
     * @param returnsWorkOrderQueryRequest
     * @return
     */
    @MediaType(
            strict = false,
            value = "application/json"
    )
    public Result<String, ResponseAttributes> returnsWorkOrderList(@Connection LxwcoatencentConnection connection, @Content ReturnsWorkOrderQueryRequest returnsWorkOrderQueryRequest) {
        PageableData<PurReturnQueryResponse> result = connection.doQuery(UrlConstant.WORKORDER_QUERY_URL, JSONUtil.parseObj(returnsWorkOrderQueryRequest));
        return connection.returnCommonResult("querySaleReturnList", result);
    }
}
